<{include file="header.html"}>
<script type="text/javascript">
function submitFilter()
{document.frm_filter.submit();
	return true;
}
getDatePicker('START_DATE');
getDatePicker('END_DATE');
</script>
<div id="content">
    <div class="container">
        <div class="main-content">
            <h1 class="title"><{$smarty.const._LB_BOOKING_MANAGEMENT|utf8_escape_html}></h1>
            <form action="<{$smarty.server.REQUEST_URI}>" method="get" name="user_form" id="form-booking">
                <table >
                <tr>
                    <td width="70">Start Date</td>
                    <td width="150"><input type="text" class="date" name="START_DATE" id="START_DATE" value="<{$filter.START_DATE}>" onchange="getWorkingHour()" size="12" /></td>
                    <td width="60"><{$smarty.const._LB_STATUS|utf8_escape_html}>&nbsp;:&nbsp;</td>
                    <td>
                        <select id="STATUS" name="STATUS">
                            <option value="-1" <{if $filter.STATUS == -1}>selected="selected"<{/if}>><{$smarty.const._LB_ALL|utf8_escape_html}></option>
                            <option value="0" <{if $filter.STATUS == 0}>selected="selected"<{/if}>><{$smarty.const._LB_WAITING_FOR_APPROVE|utf8_escape_html}></option>
                            <option value="1" <{if $filter.STATUS == 1}>selected="selected"<{/if}>><{$smarty.const._LB_APPROVED|utf8_escape_html}></option>
                            <option value="2" <{if $filter.STATUS == 2}>selected="selected"<{/if}>><{$smarty.const._LB_REJECTED|utf8_escape_html}></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>End Date</td>
                    <td><input type="text" class="date" name="END_DATE" id="END_DATE" value="<{$filter.END_DATE}>" onchange="getWorkingHour()" size="12" /></td>
                    <td><{$smarty.const._LB_SERVICE|utf8_escape_html}>&nbsp;:&nbsp;</td>
                    <td>
                        <select id="SERVICE" name="SERVICE">
                            <option value="0"><{$smarty.const._LB_ALL|utf8_escape_html}></option>
                            <{if $sData|count > 0 }>
                            <{foreach from=$sData key=gID item=data}>
                                <{assign var=gTitle value=$data.TITLE}>
                                <{assign var=sDATA value=$data.DATA}>
                                <{if $sDATA|count > 0 }>
                                    <optgroup label="<{$gTitle|utf8_escape_html}>">
                                    <{foreach from=$sDATA key=ID item=item}>
                                    <option value="<{$item.ID|utf8_escape_html}>" <{if $item.ID == $filter.ID_SERVICE}>selected="selected"<{/if}>><{$item.TITLE|utf8_escape_html}> ( <{$item.TIME|utf8_escape_html}> mins - $<{$item.PRICE|utf8_escape_html}> )</option>
                                    <{/foreach}>
                                </optgroup>
                                <{/if}>
                            <{/foreach}>
                            <{/if}>
                            </select>
                    </td>
                </tr>
				<tr>
					<td colspan="4" style="text-align: center;padding-top: 10px;">
						<button onclick="submitFilter">Search</button>
					</td>
				</tr>
            </table>
            </form>
			<br />
			<{if $bookList|count > 0 }>
            <table class="reporting" border="0" width="100%" style="border-collapse: collapse;">
                <tr style="text-align: center;font-weight: bold;">
					<th width="200px"><{$smarty.const._LB_BOOKING_INFO|utf8_escape_html}></th>
                    <th><{$smarty.const._LB_SERVICES|utf8_escape_html}></th>
					<th width="130"><{$smarty.const._LB_ACTION|utf8_escape_html}></th>
                </tr>
                <{foreach from=$bookList key=bookingID item=bookDetail}>
                <{assign var=user value=$bookDetail.USER_INFO}>
                <{assign var=techData value=$bookDetail.TDATA}>
                <{assign var=bookStatus value=$bookDetail.STATUS}>
                <tr style="border-bottom: 1px #670055 solid;">
                    <td colspan="2">
						<{$smarty.const._LB_STATUS|utf8_escape_html}> : <{$booking->status2Text($bookStatus)}><br />
					</td>
					<td>
						<a href="<{$smarty.const.APPLICATION_URL_FO}>/member/booking_detail/?id=<{$bookingID}>">Adjustment</a>
						<{if $bookStatus != 2}>
						| <a onclick="return confirm('Do you really want to Reject this booking?')" href="<{$smarty.const.APPLICATION_URL_FO}>/member/booking_reject/?id=<{$bookingID}>">Reject</a>
						<{/if}>
					</td>
                </tr>
				<{foreach from=$techData key=bdID item=data}>
				<tr>
					<td valign="top" style="border-top: 1px #670055 dotted;">
                            <{assign var=techTitle value=$data.TITLE}>
                            <{assign var=sData value=$data.SDATA}>
							<{if $data.TITLE != ""}>
                            <{$smarty.const._LB_TECHNICIAN|utf8_escape_html}>&nbsp;:&nbsp;<{$data.TITLE|utf8_escape_html}><br />
							<{/if}>
                            <{$smarty.const._LB_BOOKING_DATE|utf8_escape_html}>&nbsp;:&nbsp;<{$data.BOOKING_DATE|date_format:"%d/%m/%Y %H:%M"}><br />
                    </td>
					<td colspan="2" >
						<{foreach from=$sData item=service}>
						<{$service.TITLE|utf8_escape_html}><br />
						<{/foreach}>
					</td>
					<{/foreach}>
				</tr>
                <{/foreach}>
            </table>
            <{else}>
                <{$smarty.const._LB_NO_ITEM|utf8_escape_html}>
            <{/if}>
        </div>
        <div class="sidebar">
            <{include file="right_business_hours.html"}>
			<{include file="right_service.html"}>
        </div><!--End .sidebar-->
    </div>
</div>
<{include file="footer.html"}>